#include "ne555.h"


//
void ne555_init() {
	AUXR &= 0x7F;	
	TMOD &= 0xF0;
	TMOD |= 0x04;
	TL0 = 0;		
	TH0 = 0;
	
	TF0 = 0;				
	TR0 = 1;
}


//
uint ne555_read() {
	uint temp;
	TR0 = 0;
	
	temp = ((TH0<<8) | TL0);
	TH0 = TL0 = 0;
	
	TR0 = 1;
	return temp;
}